import React, { Component } from 'react';
import {
    View,
    Text,
    TouchableOpacity,
    ListView
} from 'react-native';

var Dimensions = require('Dimensions');
var width = Dimensions.get('window').width;
import { Historyc_style as styles } from '../../../../styles';
import Icon from 'react-native-vector-icons/Ionicons';

const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => { r1 !== r2 } });//listView 数据判断方式
export default class History_c extends Component {
    // 初始化模拟数据
    constructor(props) {
        super(props);
    }
    render() {
        //创建listView数据源
        const dataSource = ds.cloneWithRows(this.props.dataSource);
        return (
            <View style={styles.hisc_all}>
                <ListView
                    dataSource={dataSource}
                    renderRow={this.renderRow.bind(this)}
                    onEndReachedThreshold={1}
                    enableEmptySections={true}
                />
            </View>
        );
    }


    renderRow(rowData) {

        return (
            <View style={styles.hisc_listeve}>
                <Icon
                    name={'md-time'}
                    size={20}
                    color={'#aeaeae'} style={styles.hisc_time} />
                <TouchableOpacity style={[styles.hisc_poseve, { width: width * 0.7 }]} activeOpacity={1}
                    onPress={() => {
                        this.props.actions.SelResumeByConditionsAction({ resumePosition: rowData, workspace: '全国', page: 1 });
                        this.props._resumePosition(rowData);
                        this.props._horstate();
                    }}>
                    <Text style={styles.hisc_pos}>{rowData}</Text>
                </TouchableOpacity>

                <TouchableOpacity style={styles.hisc_notou} activeOpacity={1}
                    onPress={() => { this.props._deldataSource(rowData) }}>
                    <Icon
                        name={'md-close'}
                        size={20}
                        color={'#aeaeae'} />
                </TouchableOpacity>
            </View>
        )
    }
}
